package com.three.lab.bean;

import android.os.Parcel;
import android.os.Parcelable;

import com.chad.library.adapter.base.entity.MultiItemEntity;

public class ChatBean implements MultiItemEntity {

    public static final int FROM_ME = 1;
    public static final int FROM_OTHER = 2;

    private int id;
    private String userName;
    private String nickName;
    private int userId;
    private String time;
    private String avatarUrl;
    private String content;
    private int status;

    public ChatBean() {
    }

    public ChatBean(int id, String userName, String nickName, int userId, String time, String avatarUrl, String content, int status) {
        this.id = id;
        this.userName = userName;
        this.nickName = nickName;
        this.userId = userId;
        this.time = time;
        this.avatarUrl = avatarUrl;
        this.content = content;
        this.status = status;
    }

    protected ChatBean(Parcel in) {
        id = in.readInt();
        userName = in.readString();
        nickName = in.readString();
        userId = in.readInt();
        time = in.readString();
        avatarUrl = in.readString();
        content = in.readString();
        status = in.readInt();
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    public String getAvatarUrl() {
        return avatarUrl;
    }

    public void setAvatarUrl(String avatarUrl) {
        this.avatarUrl = avatarUrl;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    @Override
    public int getItemType() {
        int type = getUserId() == 8888 ? FROM_ME:FROM_OTHER;
        return type;
    }
}
